cmake_minimum_required(VERSION 3.10)

project(taskbus VERSION 1.0 LANGUAGES CXX)

set(TASKBUS_BIN_DIR  ${PROJECT_BINARY_DIR}/bin)
set(TASKBUS_INTERFACEDIR  ${PROJECT_SOURCE_DIR}/tb_interface)
set(TASKBUS_THIRDIR  ${PROJECT_SOURCE_DIR}/modules/3rdlibs)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${TASKBUS_BIN_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${TASKBUS_BIN_DIR})

option(TB_PLUTO "Turn on pluto SDR project" ON)
option(TB_UHD "Turn on Ettus USRP SDR project" ON)

if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
	set(TB64BIT True )
else()
	set(TB64BIT False )
endif()

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
	set(CMAKE_CXX_FLAGS_RELEASE "-O3")
endif()

if(CMAKE_SYSTEM_NAME MATCHES "Windows")
	#Set -utf-8 as default encoding for MSVC compiler
	if(MSVC)
		add_compile_options("-utf-8")
	endif()
endif()

#FIX MINGW64 Qt6 static link problems.
find_package(QT NAMES Qt6 COMPONENTS Core Widgets REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Widgets  REQUIRED)
if (QT_FEATURE_static STREQUAL "ON" AND WIN32 AND MINGW)
	set_property(TARGET harfbuzz::harfbuzz PROPERTY
		IMPORTED_IMPLIB ${harfbuzz_DIR}../../../libharfbuzz.dll.a )
	set(TBLinkExtra "pthread" )
else()
	set(TBLinkExtra "" )
endif()

add_subdirectory(taskbusplatform)
add_subdirectory(modules)

